The present invention relates generally to object-based high level programming environments and, more particularly, to techniques for representing string objects in object-based computing environments.
Recently the Java programming environment has become quite popular. The Java programming language is a language that is designed to be portable enough to be executed on a wide range of computers ranging from small devices (e.g., pagers, cell phones and smart cards) up to supercomputers. Computer programs written in the Java programming language (and other languages) may be compiled into Java Bytecode instructions that are suitable for execution by a Java virtual machine implementation.
The Java virtual machine is commonly implemented in software by means of an interpreter for the Java virtual machine instruction set but, in general, may be software, hardware, or both. A particular Java virtual machine implementation and corresponding support libraries together constitute a Java runtime environment.
Computer programs in the Java programming language are arranged in one or more classes or interfaces (referred to herein jointly as classes or class files). Such programs are generally platform, i.e., hardware and operating system, independent. As such, these computer programs may be executed without modification on any computer that is able to run an implementation of the Java runtime environment.
Object-oriented classes written in the Java programming language are compiled to a particular binary format called the “class file format.” The class file includes various components associated with a single class. These components can be, for example, methods and/or interfaces associated with the class. In addition, the class file format can include a significant amount of ancillary information that is associated with the class. The class file format (as well as the general operation of the Java virtual machine) is described in some detail in The Java Virtual Machine Specification, Second Edition, by Tim Lindholm and Frank Yellin, which is hereby incorporated herein by reference.
As an object-oriented programming language, Java utilizes the programming concept known as an object. In the Java programming environment, Java objects are created (instantiated) from Java classes. One common Java object is the Java string object which can represent a string of one or more characters. Conventionally, representation of each character in the string requires two bytes of data to be used. Thus, Java string objects are represented in arrays of two-byte characters (i.e., a series of entries where each entry contains a two-byte value representing a character).
As will be appreciated, the conventional representation of Java objects is inefficient since there is not always a need to represent strings in arrays of two-byte characters. In fact, the conventional approach can be grossly inefficient since, in most cases, there may not be a need to represent strings in arrays of two-byte characters. Thus, the conventional representation of Java string objects can seriously hinder the performance of a virtual machine, especially those with relatively limited resources (e.g., embedded systems with relatively smaller memory and computing power).
In view of the foregoing, alternative techniques for representation of Java string objects are needed.